/**************************************************************************************
*
*	Copyright (C) 2011 Brent Andrew O. Chua - See LICENSE.txt for more info.
*		
*	Filename	-	Logic.h
*
*	Description -	The application logic where all data structures related to the
*						applications are located. 
*
*	Comments	-
*
*	Modification History:
*			Name			   Date					Description
*			CodeSushi	-	06/16/2011	-	Creation of this file
**************************************************************************************/

#ifndef _PSX_LOGIC_H_
#define _PSX_LOGIC_H_

#include "PulseSTD.h"
#include "ProcessManager.h"

namespace Pulse
{
	PSX_EnumBegin( EApplicationState )
		STARTUP,
		INITIALIZE,
		RUNNING,
		SHUTDOWN,
	PSX_EnumEnd()

	class Logic
	{
	public:

		Logic( void );

		EErrorCode::Type Initialize( void );

		void Shutdown( void );

		// We call actors as programs.
		// TODO: Add, remove, move programs.

		// TODO: Work on application views.

		virtual EErrorCode::Type Load( void );

		virtual void OnUpdate( float time, float dt );

		virtual void ChangeState( EApplicationState::Type state );

		void AddProcess( Process::ProcessPointer pProcess );

		~Logic( void );

	protected:

		ProcessManager			*m_pProcessManager;
		EApplicationState::Type	m_state;

	};

	PSX_INLINE void Logic::AddProcess( Process::ProcessPointer pProcess )
	{
		m_pProcessManager->AddProcess( pProcess );
	}

}

#endif /* _PSX_LOGIC_H_ */